import { eventBus } from "../store/store.js";

var todolistObj = {
    template: `
    <div>
        <div class="body-head">
            <h2>待办事项:</h2>
            <div class="num">{{indexlist}}</div>
        </div>       
        <ol class="todo">
            <li class="do" v-for="(item,index) in list">
                {{item}}
                <button v-on:click="selClick(index)">完成</button>
                <button v-on:click="delClick(index)">删除</button>
            </li>
        </ol>
    </div>
    `,
    computed: {
        list(){
            return eventBus.list;
        },
        indexlist() {
            return eventBus.indexlist
        }

    },
    methods: {
        selClick(index) {
            eventBus.$emit("finished",index)
        },
        delClick(index) {
            eventBus.$emit("del",index)
        }
    },

}
export default todolistObj